﻿@using DormMS.Model.Enum
@{
    Layout = null;
}

<div class="w_shopcar w_submitOrder w_allorder" ng-controller="PointOrderListController">
    <div class="f_a_row">
        <!--全部-->
        <div class="w_allod_change">
            <div class="w_shopcar_pershop " ng-repeat="order in List">
                <div class="w_scPershop_ti">
                    <span>{{order.OrderNo}}</span>
                    <p class="w_allorder_state w_allState_red">{{order.StatusDes}}</p>
                </div>
                <div class="w_odt_procon">
                    <div ng-repeat="item in order.OrderDetailList" style="width:100%">
                        <div class="w_odtpro_conleft"><img src="{{ImgHostUrl+item.ImgUrl}}" /></div>
                        <div class="w_odtpro_conright">
                            <div class="w_odtpro_name">{{item.ProductName}}</div>
                            <p class="w_submitOrder_gg">{{item.SpecName}}</p>
                            <div class="w_shopcar_more">
                                <font color="#eb272a"><small>积分：</small>{{order.UsePoints}}</font>
                            </div>
                        </div>
                    </div>
                    @*<div class="w_allod_persum">合计：<font color="#ff4242">{{order.UsePoints}}</font></div>*@
                    <div class="w_allod_sub">
                        <a ng-show="order.OrderState==@((int)OrderStatus.已确认)&&order.SendStatus === @((int)OrderSendStatus.已发货)" ng-click="confirmOrder(order.Id)" class="w_allod_subBlack">确认收货</a>
                        @*<a ng-show="order.OrderState==@((int)OrderStatus.已收货)" ng-click="$state.go('user.addcomment',{orderId:order.Id})" class="w_allod_subBlack">去评价</a>
                        <a ng-show="order.OrderState==@((int)OrderStatus.已取消)" class="w_allod_subBlack" ng-click="delOrder(order.Id)">删除订单</a>
                        <a ng-show="order.IsAllowReturn" class="w_allod_subBlack" ng-click="$state.go('shop.return',{id:order.Id})">申请退货</a>*@
                    </div>
                </div>
            </div>
        </div>
        <!--全部-->
    </div>
</div>
<script>
    App.controller('PointOrderListController', [
            '$scope', '$state', '$route', '$rootScope', '$http',
                function ($scope, $state, $route, $rootScope, $http) {

                    layer.load(2);
                    $http.post("/Order/GetMyPointOrderList").then(function (response) {
                        layer.closeAll('loading');
                        if (response.data.isSuccess) {
                            $scope.List = response.data.data;
                        }
                        else {
                            layer.msg(response.data.msg);
                        }
                    });

                    var tt = function () {
                        $rootScope.WxShare($rootScope.pageTitle(), '优品三悦', location.href, $rootScope.LogoUrl);
                    }

                    setTimeout(tt, 1000)

                    $scope.confirmOrder = function (id) {


                        layer.confirm('确认收货吗？', {
                            btn: ['确定', '取消'] //按钮
                        }, function () {
                            layer.load(2);
                            $http.post("/Order/ConfirmOrder", { id: id }).then(function (response) {
                                if (response.data.isSuccess) {
                                    layer.msg("操作成功");
                                    $http.post("/Order/GetMyPointOrderList").then(function (response) {
                                        layer.closeAll('loading');
                                        if (response.data.isSuccess) {
                                            $scope.List = response.data.data;
                                        }
                                        else {
                                            layer.msg(response.data.msg);
                                        }
                                    });
                                }
                                else {
                                    layer.closeAll('loading');
                                    layer.msg(response.data.msg);
                                }

                            });
                        }, function () {

                        });
                    }
                }


    ]);
</script>